class StatusEffects():
    
    type = ""
    value = 0
    time = 0
    tower = None
    
    dot_active = False
    dot_timer = 0
    dot_damage = 0
    dot_tower = None
    
    speed_active = False
    speed_timer = 0
    speed_modifier = 0
    speed_tower = 0
    
    def __init__(self):
        pass
    
    def update(self, ship):
        if self.dot_active:
            self.dot_timer -= 1 # TODO: Make time dependent
            ship.health -= self.dot_damage # TODO: Scale with time
            if ship.health <= 0:
                self.dot_tower.add_kill(ship)
            if self.dot_timer <= 0:
                self.dot_active = False
        if self.speed_active:
            self.speed_timer -= 1 # TODO: Make time dependent
            ship.speed = ship.base_speed*self.speed_modifier
            if self.speed_timer <= 0:
                ship.speed = ship.base_speed
                self.speed_active = False
    
    
    def addDebuff(self):
        pass
    
    def add_dot(self, tower):
        self.dot_active = True
        self.dot_timer = tower.dot_timer
        self.dot_damage = tower.dot_damage
        self.dot_tower = tower
        
    def add_speed_modifier(self, tower):
        self.speed_active = True
        self.speed_timer = tower.speed_timer
        self.speed_modifier = tower.speed_modifier
        self.speed_tower = tower